(function () {

    let node_modules = "node_modules";

    requirejs.config({
        shim: {
            dilu: {
                exports: "maishu-dilu"
            },
            fetch: {
                exports: 'fetch'
            },
            'react-dom': {
                deps: ['react'],
                exports: window['ReactDOM']
            },
            react: {
                exports: window['React']
            },
            controls: {
                deps: ['react-dom', 'react']
            },
            application: {
                deps: ['chitu']
            },
            mobileControls: {
                exports: 'controls',
                deps: ['hammer', 'bezier-easing', 'react']
            },
            userServices: {
                exports: 'userServices'
            },
            ui: {
                exports: 'ui',
                deps: ['polyfill']
            },
            site: {
                deps: ['react', 'chitu', 'polyfill']
            },
            'prop-types': {
                deps: ['react']
            },
            'chitu': {
                deps: ['polyfill']
            }
        },
        baseUrl: '../',
        paths: {

            css: 'lib/css',
            less: 'lib/require-less-0.1.5/less',
            lessc: 'lib/require-less-0.1.5/lessc',
            normalize: 'lib/require-less-0.1.5/normalize',
            text: 'lib/text',

            'art-template': 'lib/template-web',
            'bezier-easing': 'lib/bezier-easing',
            // chitu: 'lib/chitu',
            'chitu': 'lib/chitu',
            dilu: 'lib/dilu',
            fetch: 'lib/fetch',
            hammer: 'lib/hammer',
            iscroll: 'lib/iscroll-lite',
            react: 'lib/react.development',
            'react-dom': 'lib/react-dom.development',
            'chitu.mobile': 'lib/chitu.mobile',
            carousel: 'lib/carousel',
            formValidator: 'lib/formValidator',

            "js-md5": `${node_modules}/js-md5/build/md5.min`,
            mobileControls: 'lib/mobileControls',
            polyfill: 'lib/polyfill',
            'prop-types': 'lib/prop-types',
            userServices: 'services',
            // services: './services',
            ui: 'lib/ui',
            // user: '.',
            // admin: '../admin',
            // share: '../share',
            // 'share/common': '../share/common',
            // build: 'user/build',
            // site: 'user/site',
            modules: 'user/modules',

            "maishu-wuzhui": `${node_modules}/maishu-wuzhui/dist/index`,
            'maishu-chitu': `${node_modules}/maishu-chitu/dist/index`,
            "maishu-dilu": `${node_modules}/maishu-dilu/dist/index`,
            "maishu-chitu-react": `${node_modules}/maishu-chitu-react/dist/index`,
            "maishu-wuzhui-helper": `${node_modules}/maishu-wuzhui-helper/dist/index`,
            "maishu-chitu-service": `${node_modules}/maishu-chitu-service/dist/index`,
            "maishu-ui-toolkit": `${node_modules}/maishu-ui-toolkit/dist/index`,
            "maishu-services-sdk": `${node_modules}/maishu-services-sdk/dist/index`,
            "maishu-haoyi-shop": `${node_modules}/maishu-haoyi-shop/`,
        }
    });

    // requirejs(['user/build'], function () {
    requirejs(["css!lib/Font-Awesome-3.2.1/css/font-awesome"]);
    requirejs(['react', 'react-dom', 'user/application', 'ui', 'prop-types'],
        function (React, ReactDOM, appExports) {
            window['React'] = React;
            window['ReactDOM'] = ReactDOM;
            window['h'] = React.createElement;

            ui.dialogConfig.dialogContainer = document.getElementById('dialogContainer');

            let app = window["user-app"] = new appExports.UserApplication();
            app.run();
        })
    // })


})()